﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_HocVien_DanhDachHocVien : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
            LoadMess();
        }
    }

    private void LoadMess()
    {
        if (Session["Mess"] != null && Session["Type"].ToString().Equals("Success"))
        {
            String mess = "<div class='alert alert-success alert-dismissable'>";
            mess += "<i class='fa fa-check'></i>";
            mess += "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>";
            mess += Session["Mess"].ToString() + "</div>";
            Session.Remove("Mess");
            Session.Remove("Type");
            ltrMess.Text = mess;
        }
        if (Session["Mess"] != null && Session["Type"].ToString().Equals("Error"))
        {
            String mess = "<div class='alert alert-danger alert-dismissable'>";
            mess += "<i class='fa fa-ban'></i>";
            mess += "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>";
            mess += Session["Mess"].ToString() + "</div>";
            Session.Remove("Mess");
            Session.Remove("Type");
            ltrMess.Text = mess;
        }
    }

    private void LoadData()
    {
        List<HocVienINFO> list = HocVienDAL.listAll();
        GridView1.DataSource = list;
        GridView1.DataBind();
    }
}